package com.general.box.knowledge

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

public class KnowledgeMainActivity : AppCompatActivity() {

    companion object {
        const val TYPE = "type"
        const val TYPE_FLOWER = 1
        const val TYPE_TEAM = 2
        const val TYPE_BOOK = 3
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.ko_activity_knowledge_main)

        val mType = intent.getIntExtra(TYPE, -1)
        if (mType <= 0) {
            throw java.lang.RuntimeException("no type")
        }

        val transient = supportFragmentManager.beginTransaction()

        if (mType == TYPE_FLOWER) {
            transient.add(R.id.container, KoFlowerFragment())
        }
        if (mType == TYPE_TEAM) {
            transient.add(R.id.container, KoTeamFragment())
        }
        if (mType == TYPE_BOOK) {
            transient.add(R.id.container, KoBookFragment())
        }

        transient.commitNowAllowingStateLoss()
    }

//    override fun onCreate(savedInstanceState: Bundle?) {
//        super.onCreate(savedInstanceState)
//        setContentView(R.layout.activity_common_setting)
//        supportFragmentManager.beginTransaction().add(R.id.container, CommonSettingFragment.getInstance()).commit()
//    }

}